package com.maomao.maomaochong_i.quanxing.Adpater;

import com.maomao.maomaochong_i.quanxing.Phone;
import com.maomao.maomaochong_i.global.Show;
import com.maomao.maomaochong_i.quanxing.PhoneData.PhoneData;
import com.maomao.maomaochong_i.quanxing.ShanPingShuJu;
import com.maomao.maomaochong_i.quanxing.Xiugai;
import com.maomao.maomaochong_i.quanxing.YingYong;

import java.util.ArrayList;

/**
 * Created by Mrma on 17.6.8.
 */

public class InterestinProductAdapter implements YingYong,Xiugai {
    public Phone phone;

    public PhoneData PhoneData;

    private static InterestinProductAdapter gwc;
    private ArrayList<ShanPingShuJu> getlist;

    public ArrayList<ShanPingShuJu> getGetlist() {
        return getlist;
    }

    public static InterestinProductAdapter getOne(){
        return gwc;
    }

    public static InterestinProductAdapter getOne(Phone quanxingsj){
        if(gwc == null){
            gwc = new InterestinProductAdapter(quanxingsj);
        }
        return gwc;
    }

    private InterestinProductAdapter(Phone phone){
        this.phone = phone;
        phone.tianjia(this);

    }

    @Override
    public void play() {
        PhoneData.classfiy(Show.INTERESSTION);
        getlist = PhoneData.getList();
        System.out.println("旧："+getlist.get(0));
    }


    @Override
    public void xiugai(PhoneData PhoneData) {
        this.PhoneData = PhoneData;
        play();
    }
}
